package com.yyg.traffic.gateway.fille;

import com.netflix.zuul.ZuulFilter;
import com.netflix.zuul.exception.ZuulException;
import lombok.extern.slf4j.Slf4j;
import org.springframework.cloud.netflix.zuul.filters.support.FilterConstants;
import org.springframework.stereotype.Component;

/**
 * @Author: 一一哥
 * @Blame: yyg
 * @Since: Created in 2021/1/26
 * @Description: $cursor$
 */
@Slf4j
@Component
public class FourthFilter extends ZuulFilter {

    /**
     * 指明过滤器的类型,pre,route,post,error
     */
    @Override
    public String filterType() {

        //return "post";

        return FilterConstants.POST_TYPE;
    }

    /**
     * 过滤器的执行顺序,在同一类过滤器中,值越小,优先级越高!
     */
    @Override
    public int filterOrder() {

        return 4;
    }

    /**
     * true:下面的run()会执行,否则不会执行.
     */
    @Override
    public boolean shouldFilter() {

        return true;
    }

    /**
     * 整个过滤器中的核心方法,用来处理过滤器的核心业务逻辑.
     */
    @Override
    public Object run() throws ZuulException {

        log.warn("第4个post过滤器...");

        return null;
    }

}
